package Exception2;
import java.util.Scanner;
public class TestBinaryToDecimal {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String binary;
        System.out.println("Please input a binary string:");
        while(true){
            try{
                binary = input.nextLine();
                int n = BinaryToDecimal.binaryToDecimal(binary);
                System.out.println(n);
            }
            catch(BinaryFormatException binaryFormatException){
                System.out.println(binaryFormatException.getMessage());
                System.out.println("Please input again.");
                continue;
            }
            break;
        }
    }
}